/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lab8;

public class Cat extends Operator {
    @Override
    public double calcul(double aux1, double aux2)
    {
         return aux1 / aux2;
    }
    public static double Calcul(double aux1, double aux2)
    {
         return aux1 / aux2;
    }
    @Override
    public double calculDerivata()
    {
        if (fStang==null || fDrept==null)
        System.exit(1);
        return calcul(fStang.calculDerivata(), fDrept.calculDerivata());
    }
    @Override
    public String derivare()
    {
        if (fStang==null || fDrept==null)
        System.exit(1);
        return Cat.concatTermens(Minus.concatTermens(Produs.concatTermens(this.fStang.derivare(),this.fDrept.toString()),Produs.concatTermens(this.fStang.toString(), this.fDrept.derivare())),this.fDrept.toString()+"^2");
    }

    @Override
    public String concatTermeni(String aux1, String aux2)
    {
        String aux;
        if (aux1.compareTo("1") == 0 || aux2.compareTo("1") == 0)
        //if (!strcmp(aux1, "0") && !strcmp(aux2, "0"))
        aux = aux1;
        else if (aux1.compareTo("1") == 0) aux = aux2;
        else if (aux2.compareTo("1") == 0 ) aux = aux1;
        else
        aux = aux1 + "/" + aux2;
        return aux;
    }
        public static String concatTermens(String aux1, String aux2)
    {
        String aux;
        if (aux1.compareTo("1") == 0 || aux2.compareTo("1") == 0)
        //if (!strcmp(aux1, "0") && !strcmp(aux2, "0"))
        aux = aux1;
        else if (aux1.compareTo("1") == 0) aux = aux2;
        else if (aux2.compareTo("1") == 0 ) aux = aux1;
        else
        aux = aux1 + "/" + aux2;
        return aux;
    }
}


